////////////////////////////////////////////////////////////////////////////////
//
//  Copyright (c) 2010 Leon Coto Rodriguez
//  leoncoto@gmail.com
//  
//  Permission is hereby granted, free of charge, to any person
//  obtaining a copy of this software and associated documentation
//  files (the "Software"), to deal in the Software without
//  restriction, including without limitation the rights to use,
//  copy, modify, merge, publish, distribute, sublicense, and/or sell
//  copies of the Software, and to permit persons to whom the
//  Software is furnished to do so, subject to the following
//  conditions:
//  
//   The above copyright notice and this permission notice shall be
//   included in all copies or substantial portions of the Software.
//  
//  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
//  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
//  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
//  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
//  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
//  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
//  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
//  OTHER DEALINGS IN THE SOFTWARE.
//
////////////////////////////////////////////////////////////////////////////////
package org.flexspeedup.model 
{
/**
 * An abstract representation for any resultset object returned by an AMF 
 * collection manager service
 * 
 *  @langversion 3.0
 *  @playerversion Flash 9
 *  @playerversion AIR 1.1
 *  @productversion Flex 3
 */
[Bindable]
public class ResultSet implements IResultSet
{
    //--------------------------------------------------------------------------
    //
    //  Constructor
    //
    //--------------------------------------------------------------------------
    
    /**
     * Creates a new ResultSet with default values.
     * 
     * @param The page represented by this resultset in the data collection.
     * 
     * @param itemCountPerPage The maximum item count that will this resulset
     * return or contain.
     */
    public function ResultSet(currentPage:int = 1, itemCountPerPage:int = 10)
    {
        this.currentPage = currentPage;
        this.itemCountPerPage =  itemCountPerPage;
    }
    
    //--------------------------------------------------------------------------
    //
    // Properties
    //
    //--------------------------------------------------------------------------   

    //----------------------------------
    //  firstPage
    //----------------------------------
    /**
     *  @private
     */    
    private var _firstPage:int;
    
    /**
     * @inheritDoc org.flexspeedup.model.IResultSet#firstPage
     */
    public function get firstPage():int
    {
        return _firstPage;
    }
    
    public function set firstPage(value:int):void
    {
        _firstPage = value;
    }

    //----------------------------------
    //  currentPage
    //----------------------------------
    /**
     *  @private
     */    
    private var _currentPage:int;
    
    /**
     * @inheritDoc org.flexspeedup.model.IResultSet#currentPage
     */
    public function get currentPage():int
    {
        return _currentPage;
    }
    
    public function set currentPage(value:int):void
    {
        _currentPage = value;
    }

    //----------------------------------
    //  nextPage
    //----------------------------------
    /**
     *  @private
     */    
    private var _nextPage:int;
    
    /**
     * @inheritDoc org.flexspeedup.model.IResultSet#nextPage
     */
    public function get nextPage():int
    {
        return _nextPage;
    }
    
    public function set nextPage(value:int):void
    {
        _nextPage = value;
    }

    //----------------------------------
    //  lastPage
    //----------------------------------
    /**
     *  @private
     */    
    private var _lastPage:int;
    
    /**
     * @inheritDoc org.flexspeedup.model.IResultSet#lastPage
     */
    public function get lastPage():int
    {
        return _lastPage;
    }
    
    public function set lastPage(value:int):void
    {
        _lastPage = value;
    }

    //----------------------------------
    //  previousPage
    //----------------------------------
    /**
     *  @private
     */    
    private var _previousPage:int;
    
    /**
     * @inheritDoc org.flexspeedup.model.IResultSet#previousPage
     */
    public function get previousPage():int
    {
        return _previousPage;
    }
    
    public function set previousPage(value:int):void
    {
        _previousPage = value;
    }

    //----------------------------------
    //  itemCountPerPage
    //----------------------------------
    /**
     *  @private
     */    
    private var _itemCountPerPage:int;
    
    /**
     * @inheritDoc org.flexspeedup.model.IResultSet#itemCountPerPage
     */
    public function get itemCountPerPage():int
    {
        return _itemCountPerPage;
    }
    
    public function set itemCountPerPage(value:int):void
    {
        _itemCountPerPage = value;
    }

    //----------------------------------
    //  items
    //----------------------------------
    /**
     *  @private
     */    
    private var _items:Array;
    
    /**
     * @inheritDoc org.flexspeedup.model.IResultSet#items
     */
    public function get items():Array
    {
        return _items;
    }
    
    public function set items(value:Array):void
    {
        _items = value;
    }

    //----------------------------------
    //  totalItemCount
    //----------------------------------
    /**
     *  @private
     */    
    private var _totalItemCount:int;
    
    /**
     * @inheritDoc org.flexspeedup.model.IResultSet#totalItemCount
     */
    public function get totalItemCount():int
    {
        return _totalItemCount;
    }
    
    public function set totalItemCount(value:int):void
    {
        _totalItemCount = value;
    }

    //----------------------------------
    //  pageCount
    //----------------------------------
    /**
     *  @private
     */    
    private var _pageCount:int;
    
    /**
     * @inheritDoc org.flexspeedup.model.IResultSet#pageCount
     */
    public function get pageCount():int
    {
        return _pageCount;
    }
    
    public function set pageCount(value:int):void
    {
        _pageCount = value;
    }

}
}